package com.life.wd.controller;

import com.life.wd.dto.UserDTO;
import com.life.wd.result.PageResult;
import com.life.wd.result.Result;
import com.life.wd.service.UserService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/user")
@Slf4j
@Api(tags = "用户管理")
public class UserController {

    @Autowired
    private UserService userService;

    @PostMapping
    public Result<PageResult> select(@RequestBody UserDTO userDTO) {
        log.info("查询用户：{}", userDTO);
        PageResult users = userService.pageQuery(userDTO);
        return Result.success(users);
    }
}